package com.softwareconstruction.selection;

import com.softwareconstruction.paper.Paper;
import com.softwareconstruction.student.Student;

import java.util.HashSet;
import java.util.Set;

/**
 * 统计选择了至少1篇论文的学生数量
 */
public class StudentCountVisitor implements Visitor {
    private Set<String> studentNames = new HashSet<>();

    @Override
    public void visit(Paper paper, Student student) {
        studentNames.add(student.getName());
    }

    public int getCount() {
        return studentNames.size();
    }
}